package com.example.controller;

import com.example.domain.Room;
import com.example.service.LectureService;
import com.example.service.RoomService;
import com.example.util.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:RoomController
 * Package:com.example.controller
 * User:HP
 * Date:2025/8/25
 * Time:下午8:44
 * Author 周东汉
 * Version 1.0
 * Description:
 */

@RestController
@RequestMapping("/api/room")
public class RoomController {

    @Resource
    private RoomService roomService;

    @Resource
    private LectureService lectureService;

    @GetMapping("/info")
    public Room getRoomInfo(@RequestParam Long id) {
        return roomService.getById(id);
    }

    @GetMapping("/seats")
    public Result getSeats(@RequestParam Long roomId) {
        return roomService.getSeats(roomId);
    }

    @GetMapping("/lectures")
    public Result getLectures(@RequestParam Long roomId) {
        return lectureService.getLecturesByRoomId(roomId);
    }

    @GetMapping("/all")
    public Result getAllRooms() {
        return roomService.getAll();
    }

}
